//
//  SAShopGoodsListCell.m
//  YunFu
//
//  Created by Bager on 2018/9/12.
//  Copyright © 2018年 yunfu. All rights reserved.
//

#import "SAShopGoodsListCell.h"

@implementation SAShopGoodsListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self setViews];
    }
    
    return self;
}

- (void)setViews
{
    [self addSubview:self.img];
    [self addSubview:self.name];
    [self addSubview:self.type];
    [self addSubview:self.price];
    [self addSubview:self.address];
}

- (UIImageView *)img
{
    if (!_img)
    {
        _img = [[UIImageView alloc] initWithFrame:CGRectMake(kPublicMargin, 5, 110, 110)];
        _img.contentMode = UIViewContentModeScaleAspectFill;
        _img.layer.masksToBounds = YES;
        _img.layer.cornerRadius = 4;
        [_img setImage:[UIImage imageNamed:@"yf2-mddh1-15"]];
    }
    return _img;
}

- (UILabel *)name
{
    if (!_name)
    {
        _name = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.img.frame) + 10, 5, kScreenWidth - kPublicMargin - CGRectGetMaxX(self.img.frame) - 10, 36)];
        _name.font = [UIFont systemFontOfSize:14];
        _name.numberOfLines = 2;
        _name.text = @"外星人Alienware15.6英寸Gsync屏游戏笔记本电脑(i7-7700HQ 8G 256GSSD+1T GTX1050Ti 2G独显 FHD 酷炫灯效)";
    }
    return _name;
}

- (UILabel *)type
{
    if (!_type)
    {
        _type = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.name.frame), CGRectGetMaxY(self.name.frame), CGRectGetWidth(self.name.frame), 20)];
        _type.font = [UIFont systemFontOfSize:12];
        _type.textColor = [UIColor grayColor];
        _type.text = @"店铺券满3000减100";
    }
    return _type;
}

- (UILabel *)price
{
    if (!_price)
    {
        _price = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.name.frame), CGRectGetMaxY(self.type.frame) + 5, CGRectGetWidth(self.name.frame), 20)];
        _price.font = [UIFont systemFontOfSize:10];
        _price.textColor = [UIColor lightGrayColor];
        _price.adjustsFontSizeToFitWidth = YES;
        _price.text = @"¥ 4888 12万人付款";
    }
    return _price;
}

- (UILabel *)address
{
    if (!_address)
    {
        _address = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.name.frame), CGRectGetMaxY(self.price.frame), CGRectGetWidth(self.name.frame), 20)];
        _address.font = [UIFont systemFontOfSize:10];
        _address.textColor = [UIColor lightGrayColor];
        _address.adjustsFontSizeToFitWidth = YES;
        _address.text = @"荣耀旗舰店 广州";
    }
    return _address;
}

@end
